#ifndef String_First
#define String_First
#ifdef __GNUG__
#pragma interface
#endif

#include "Types.h"
#include "ET_varargs.h"
#include "Storage.h"
#include "CType.h"

extern "C" {

char*   strsave(const char *s, int len= -1);  // allocate a buffer and copy 's'

char*   strcat(char *to, const char *from);
char*   strncat(char *to, const char *from, size_t len);

char*   strcpy(char *to, const char *from);
char*   strncpy(char *to, const char *from, size_t len);

int     strcmp(const char*, const char*);
int     strncmp(const char*, const char*, size_t len);
#ifndef __GNUG__
int     memcmp(const void*, const void*, size_t len);
#endif

#ifndef __GNUG__
size_t  strlen(const char*);
#endif

char *strchr(const char*, int);
char *strrchr(const char*, int);
char *strtok(char*, const char*);

void *memset(void *to, int what, size_t len);

}

// string utilites
extern char* strprintf(const char *fmt, ...);
	// allocate a buffer and copy the string specified in fmt a la printf
extern char* strvprintf(const char*, va_list);
extern char* strreplace(char **dst, const char *src, int l= -1);
	// replace dst with src, expanding dst if necessary
extern char* strfreplace(char**, const char *fmt, ...);
extern char* strvreplace(char**, const char *fmt, va_list);
extern bool  strismember(const char *s, ...);
	// return TRUE when s equals one of the following arguments
extern char *strquotechar(byte ch, char *bufp);
extern char* strn0cpy(char*, const char*, int);
	// strncpy which establises always a terminating 0 byte
extern u_long strhash(const char*);

extern int StrCmp(const byte*, const byte*, int l= -1, const byte *map= 0);
inline int StrCmp(const char *s1, const char *s2, int l= -1, const byte *map= 0)
	{ return StrCmp((const byte*)s1, (const byte*)s2, l, map); }

extern const char *BaseName(const char *pathname);
extern char *form(const char *fmt, ...);     // printf format
extern int StuffChar(const char *src, char *dst, int dstlen, char* specchars, char stuffchar);
extern void *MemCpy(void *to, const void *from, size_t len);

#endif

